1. Field of the Invention
The present invention is related to digital image processing technology, particularly to a method and apparatus for determining whether adjacent macroblocks are located in the same slice in the deblocking process of block-based digitally encoded image.
2. Description of the Prior Art
A block-based digitally encoded image frame is usually partitioned into macroblocks (MB), and luminance and chroma components of pixels (picture elements) therein are encoded separately. A macroblock typically refers to an image area containing 16×16 pixels. In the video coding protocol like H.264, a macroblock may be further divided into several 16×8, 8×16, 8×8, 8×4, 4×8, or 4×4 partitions or sub-partitions. A slice is a sequence of macroblocks. A picture may be split into one or several slices as shown in FIG. 1. FIG. 1 illustrates a blocked-based digital image 100 including several slices. There are 4 slices Slice0-Slice3 in the blocked-based digital image 100. Slices are self-contained in the sense that given the active sequence and picture parameter sets, their syntax elements can be parsed from the bit-stream and the values of the samples in the area of the picture that the slice represents can be correctly decoded without use of data from other slices provided that utilized reference pictures are identical at encoder and decoder.
Visual defects, such as blocking effects, usually appear in blocked-based decoded images. A deblocking process is generally employed to remove or mitigate such defects so as to improve the decoded image quality. In the protocol like H.264, it may choose whether to execute the deblocking process for adjacent macroblocks across slices or not. Referring to FIG. 2, it illustrates the spatial relationship of the current macroblock MBCur and its neighboring macroblocks MBA, MBB and MBC, in which the current macroblock MBCur is the macroblock under decoding or processing, the macroblock MBA lies to the left of the current macroblock MBCur, and the macroblock MBB is located exactly above the current macroblock MBCur. The macroblocks MBA and MBB are generally referred to as the left macroblock and the top macroblock of the current macroblock MBCur respectively. If the current macroblock MBCur and its adjacent macroblock MBA (or MBB) lie in different slices, then it may choose to skip the deblocking process for the boundary between macroblocks MBCur and MBA (or MBB). Therefore, it is desirable to determine whether any adjacent macroblocks are in the same slice in the image decoding operation containing a deblocking process.
A straightforward way to determine whether adjacent macroblocks are in the same slice is to record the slice of every macroblock during the decoding process. As shown in FIG. 2, if the slices of macroblock MBCur and all its adjacent blocks are recorded, then it can be used to determine whether adjacent macroblocks are in the same slice in any subsequent process. However, total number of slices in a digitally encoded picture may be equal to the amount of macroblocks contained therein, that is, each slice contains one macroblock only. For instance, if there are 1920×1024 pixels in a digitally encoded image, then the image would include 7680 (1920×1024 divided by 16×16) macroblocks. In the worst case, the image may include 7680 slices, which means temporary memory spaces of 7680 slice numbers should be reserved in the system memory to record slice numbers of all macroblocks. If a slice number takes up 13 bits, then totally 12480 bytes should be reserved (7680×13 bits=99840 bits=99840/8 bytes=12480 bytes).
In view of the foregoing, there is a heed to provide an improved method for determining whether adjacent macroblocks are in the same slice to avoid wasting system memory resources.